package com.lucyyun.lcrpceasy.registry;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * Description
 *
 * @author: lucyYun
 * @date: 2024/6/24 10:24
 */
public class LocalRegistry {

    /*
    注册信息存储
     */
    private static final Map<String, Class<?>> map = new ConcurrentHashMap<>();

    /**
     *注册服务
     * @param serviceName
     * @param implClass
     */
    public static void registry(String serviceName, Class<?> implClass) {
        map.put(serviceName, implClass);
    }

    /**
     * 获取服务
     * @param serviceName
     * @return
     */
    public static Class<?> get(String serviceName){
        return map.get(serviceName);
    }

    /**
     * 删除服务
     * @param serviceName
     * @return
     */
    public static Class<?> remove(String serviceName){
        return map.remove(serviceName);
    }

}
